<?php


namespace app\admin\validate;


use think\Validate;

class AdminUser extends Validate
{
    protected $rule = [
        'username' => 'require|max:10',
        'captcha' => 'require|captchaCheck',
    ];

    protected $message = [
        'username.required' => '用户名必须填写',
        'username.max' => '名称长度不能超过10',
    ];


    public function captchaCheck($value)
    {
        if (!captcha_check($value)) {
            return '验证码不正确!!!';
        }
        return true;
    }
}